| 123456789101112131415161718192021222324252627 |
- // app/api/branches/[branch]/[year]/[month]/days/route.js
- import { NextResponse } from "next/server";
- import { listDays } from "@/lib/storage";
- export function GET(request, { params }) {
- const { branch, year, month } = params;
- if (!branch || !year || !month) {
- return NextResponse.json(
- { error: "branch, year oder month fehlt" },
- { status: 400 }
- );
- }
- return listDays(branch, month.length === 4 ? branch : year, month)
- .then((days) => NextResponse.json({ branch, year, month, days }))
- .catch((error) => {
- console.error(
- "[api/branches/[branch]/[year]/[month]/days] Fehler:",
- error
- );
- return NextResponse.json(
- { error: "Fehler beim Lesen der Tage" },
- { status: 500 }
- );
- });
- }
|